package com.ruoyi.activiti.service.impl;

import com.ruoyi.activiti.domain.CustomProcess;
import com.ruoyi.activiti.mapper.CustomProcessMapper;
import com.ruoyi.activiti.mapper.CustomProcessMapperHis;
import com.ruoyi.activiti.service.ICustomProcessService;
import com.ruoyi.activiti.service.ICustomProcessServiceHis;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Service
public class CustomProcessServiceHisImpl implements ICustomProcessServiceHis {
    @Autowired
    private CustomProcessMapperHis customProcessMapper;
    @Override
    public void saveProcess(CustomProcess customProcess) {
        customProcess.setCreateBy(SecurityUtils.getUsername());
        customProcess.setCreateTime(LocalDateTime.now());
        customProcessMapper.saveProcess(customProcess);
    }

    @Override
    public List<CustomProcess> selectList(CustomProcess process) {
        return customProcessMapper.selectList(process);
    }

    @Override
    public CustomProcess selectById(Long id) {
        return customProcessMapper.selectById(id);
    }

    @Override
    public CustomProcess selectByProcDefId(String procDefId){
        return customProcessMapper.selectByProcDefId(procDefId);
    }

    @Override
    public void deleteProcess(Long id) {
        customProcessMapper.deleteProcess(id);
    }

    @Override
    public void updateProcess(CustomProcess process) {
        customProcessMapper.updateProcess(process);
    }
}
